from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from models import Podcast, Channel

class ChannelAdmin(admin.ModelAdmin):
	fieldsets = (
	    (None, {'fields': ('site', 'name', 'slug', 'description',)}),
	)
	list_display = ('name', 'slug', 'site',)
	search_fields = ['name']
	prepopulated_fields = {'slug': ('name',)}
	
class PodcastAdmin(admin.ModelAdmin):
	fieldsets = (
	    (None, {'fields': ('channel', 'user', 'audio', 'title', 'slug',
		    'summary',)}),
	    (_(u'Tagging'), {'fields': ('tags',),}),
	    (_(u'Date information'), {'fields': ('pub_date',), 
                                  'classes': 'collapse'}),
	    (_(u'Settings'), {'fields': ('publication_status',)}),
	)
	list_display = ('title', 'pub_date', 'user', 'audio', 'publication_status',)
	list_filter = ('pub_date', 'user', 'publication_status',)
	search_fields = ['title']
	date_hierarchy = 'pub_date'
	prepopulated_fields = {'slug': ('title',)}
	radio_fields = {'publication_status': True}

admin.site.register(Channel, ChannelAdmin)
admin.site.register(Podcast, PodcastAdmin)